package de.fhtrier.mp.wollmaus.gui;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;

import de.fhtrier.mp.wollmaus.gamestate.GameState;
import de.fhtrier.mp.wollmaus.util.AssetManager;

public class GUI {
	// Ich habe das jetzt einmal hardcoded eingetragen
	// Wer will kanns flexibeler machen
	private final float NOTEBAR_X_PERCENT = 0.6f;
	private final float NOTEBAR_Y_PERCENT = 0.8f;
	
	private final float NOTE0_X_PERCENT = 0.66f;
	private final float NOTE0_Y_PERCENT = 0.925f;
	private final float NOTE1_X_PERCENT = 0.75f;
	private final float NOTE1_Y_PERCENT = 0.86f;
	private final float NOTE2_X_PERCENT = 0.82f;
	private final float NOTE2_Y_PERCENT = 0.85f;
	private final float NOTE3_X_PERCENT = 0.9f;
	private final float NOTE3_Y_PERCENT = 0.88f;
	
	private GameState main;
	
	public GUI(GameState gameState) {
		this.main = gameState;
	}
	
	public void render(GameContainer gc, Graphics g) {
		int collectedNotes = main.getPlayer().getCollectedNotes();
		AssetManager am = AssetManager.getInstance();
		
		am.getImage(AssetManager.IMAGE_NOTEBAR).draw(gc.getWidth()*NOTEBAR_X_PERCENT, gc.getHeight()*NOTEBAR_Y_PERCENT);
		
		// Note 1
		if (collectedNotes >= 1) {
			am.getImage(AssetManager.IMAGE_NOTE0).draw(gc.getWidth()*NOTE0_X_PERCENT,gc.getHeight()*NOTE0_Y_PERCENT);
		}
		else {
			am.getImage(AssetManager.IMAGE_NOTE0_TRANS).draw(gc.getWidth()*NOTE0_X_PERCENT,gc.getHeight()*NOTE0_Y_PERCENT);
		}
		// Note 2
		if (collectedNotes >= 2) {
			am.getImage(AssetManager.IMAGE_NOTE1).draw(gc.getWidth()*NOTE1_X_PERCENT,gc.getHeight()*NOTE1_Y_PERCENT);
		}
		else {
			am.getImage(AssetManager.IMAGE_NOTE1_TRANS).draw(gc.getWidth()*NOTE1_X_PERCENT,gc.getHeight()*NOTE1_Y_PERCENT);
		}
		// Note 3
		if (collectedNotes >= 3) {
			am.getImage(AssetManager.IMAGE_NOTE2).draw(gc.getWidth()*NOTE2_X_PERCENT,gc.getHeight()*NOTE2_Y_PERCENT);
		}
		else {
			am.getImage(AssetManager.IMAGE_NOTE2_TRANS).draw(gc.getWidth()*NOTE2_X_PERCENT,gc.getHeight()*NOTE2_Y_PERCENT);
		}
		// Note 4
		if (collectedNotes >= 4) {
			am.getImage(AssetManager.IMAGE_NOTE3).draw(gc.getWidth()*NOTE3_X_PERCENT,gc.getHeight()*NOTE3_Y_PERCENT);
		}
		else {
			am.getImage(AssetManager.IMAGE_NOTE3_TRANS).draw(gc.getWidth()*NOTE3_X_PERCENT,gc.getHeight()*NOTE3_Y_PERCENT);
		}
	}
}
